//
//  AskDoctorVC.m
//  Doctor
//
//  Created by cex on 2018/4/8.
//  Copyright © 2018年 mingthink. All rights reserved.
//

#import "AskDoctorVC.h"

@interface AskDoctorVC ()<UITableViewDelegate,UITableViewDataSource>
{
    UITableView *tbv_main;
    NSInteger pageIndex;
}

@end

@implementation AskDoctorVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"首页";
    [self initSubViews];
    pageIndex=1;
    //arr_model=[[NSMutableArray alloc]init];
    tbv_main.mj_header = [BORefreshHeader mt_headerWithRefreshingBlock:^{
        pageIndex=1;
        //[self requestMessageList];
    }];
    
    tbv_main.mj_footer = [BORefreshFooter mt_footerWithRefreshingBlock:^{
        pageIndex++;
        //[self requestMessageList];
    }];
    [tbv_main.mj_header beginRefreshing];
}
-(void)initSubViews
{
    tbv_main = [[UITableView alloc]initWithFrame:CGRectMake(0,NAVBAR_HEIGH, DEVW, DEVH-NAVBAR_HEIGH)];
    tbv_main.showsVerticalScrollIndicator=NO;
    tbv_main.delegate = self;
    tbv_main.dataSource = self;
    tbv_main.separatorStyle = UITableViewCellSeparatorStyleNone;
    UIView *view = [[UIView alloc]initWithFrame:CGRectZero];
    tbv_main.tableFooterView = view;
    [self.view addSubview:tbv_main];
    
}
#pragma mark - tableView delegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identifier = @"CellIdentifier";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier];
        cell.selectionStyle=UITableViewCellSelectionStyleNone;
        
        CGFloat portraitWidth=50;
        UIImageView *imgv_portrait = [[UIImageView alloc]init];
        [cell.contentView addSubview:imgv_portrait];
        imgv_portrait.contentMode = UIViewContentModeScaleAspectFit;
        imgv_portrait.backgroundColor = [UIColor purpleColor];
        imgv_portrait.layer.cornerRadius=portraitWidth/2;
        imgv_portrait.layer.masksToBounds=YES;
        
        //imgv_portrait.image = [UIImage imageNamed:<#imgvName#>];
        imgv_portrait.sd_layout.leftSpaceToView(cell.contentView,CELL_LEFT_MARGIN).centerYEqualToView(cell.contentView).widthIs(portraitWidth).heightEqualToWidth();
        
        UILabel *lab_name = [[UILabel alloc]init];
        [cell.contentView addSubview:lab_name];
        lab_name.text = @"李刚";
        lab_name.font = GET_SYSTEM_FONT(TEXT_FONT_30);
        lab_name.textColor = GET_HEX_COLOR(TEXT_DEEP_BLACK);
        lab_name.sd_layout.topSpaceToView(cell.contentView,CELL_TOP_BOTTOM_MARGIN).leftSpaceToView(imgv_portrait,10).heightIs(20);
        [lab_name setSingleLineAutoResizeWithMaxWidth:DEVW];
        
        UILabel *lab_profession = [[UILabel alloc]init];
        [cell.contentView addSubview:lab_profession];
        lab_profession.text = @"妇科-主任医师";
        lab_profession.font = GET_SYSTEM_FONT(TEXT_FONT_24);
        lab_profession.textColor = GET_HEX_COLOR(TEXT_GRAY);
        lab_profession.sd_layout.leftSpaceToView(lab_name,5).centerYEqualToView(lab_name).heightIs(20);
        [lab_profession setSingleLineAutoResizeWithMaxWidth:DEVW];
        
        UIImageView *imgv_icon = [[UIImageView alloc]init];
        [cell.contentView addSubview:imgv_icon];
        imgv_icon.contentMode = UIViewContentModeScaleAspectFit;
        imgv_icon.backgroundColor = [UIColor purpleColor];
        
        //imgv_portrait.image = [UIImage imageNamed:<#imgvName#>];
        imgv_icon.sd_layout.topSpaceToView(lab_name,5).leftEqualToView(lab_name).widthIs(15).heightEqualToWidth();
        
        UILabel *lab_intro = [[UILabel alloc]init];
        [cell.contentView addSubview:lab_intro];
        //lab_intro.text = @"妇科-主任医师";
        lab_intro.font = GET_SYSTEM_FONT(TEXT_FONT_24);
        lab_intro.textColor = GET_HEX_COLOR(TEXT_GRAY);
        lab_intro.sd_layout.leftSpaceToView(lab_name,5).centerYEqualToView(lab_name).heightIs(20);
        [lab_intro setSingleLineAutoResizeWithMaxWidth:DEVW];
        
    }
    //cell.model=arr_model[indexPath.row];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    //    CGFloat  cellHeight = [tbv_main cellHeightForIndexPath:indexPath model:arr_model[indexPath.row] keyPath:@"model" cellClass:MessageCell.class contentViewWidth:DEVW];
    return 80;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
